﻿namespace LearnDSSortings;

public class InsertionSort
{
    public void Search(int[] arr)
    {
        int n = arr.Length;
        for (int i = 1; i < n; i++)
        {
            int temp = arr[i];
            int position = i;
            while (position > 0 && arr[position - 1] > temp)
            {
                arr[position] = arr[position - 1];
                position--;
            }

            arr[position] = temp;
        }
    }

    private void Swap(int[] arr, int i, int j)
    {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
}